#ifndef MONSTERWIDGET_H
#define MONSTERWIDGET_H

#include <QWidget>
#include <QResource>
#include <QPixmap>
#include <QCursor>
#include <Qstring>
#include <QBrush>
#include <QImage>
#include <QPalette>
#include <QDebug>
#include <QFont>
#include <QMouseEvent>
#include <QGraphicsOpacityEffect>
#include "MainWindow.h"
#include "Monster.h"
#include "WidgetFade.h"


namespace Ui {
    class MonsterWidget;
}

class MonsterWidget : public QWidget
{
    Q_OBJECT
public:
    explicit MonsterWidget(MainWindow * mainWindow,  Monster * monster, QWidget *parent = 0);
    ~MonsterWidget();




    /*
     *  Function to set the color of the mob depending of what is set in the Monster object
     */
    void setMonsterColor();

    /*
     *  Function to set the image of the mob depending of what is set in the Monster object
     */
    void setMonsterType();


    /*
     *  Function to activate or desactivate the glow effect
     *  @param bool activate : True = the glow will be visible, False = the glow will be hidden and a dropped shadow will take place instead.
     */
    void setGlow(bool activate);

    /*
     *  Function to show the black overlay to the specified percent
     *  @param int percent : percent of the overlay (100% all the widget will be cover, 0, the overlay is hidden)
     */
    void setOverlay(int percent);


    /*
     *  Function write a text in the middle of the widget
     *  @param QString text : Text to write
     */
    void setTime(int time);


    /*
     *  Function write a text in the middle of the widget
     *  @param QString text : Text to write
     */
    void setText(QString text);




    /*
     *  Function to kill the monster
     */
    void kill();

    /*
     *  Function to update the tooltip of the widget
     *  @param bool shouldWait : If the function should wait the cooldown thread
     */
    void setAlive(bool shouldWait = true);

    /*
     * Function to update the tooltip of the widget
     */
    void updateTooltip();

private:
    Monster * monster;              //Pointer to the Monster Thread
    MainWindow * mainWindow;        //Pointer to the mainWindow
    Ui::MonsterWidget *ui;          //Pointer to the UI

public slots:
    void slotSateChanged(bool);
    void slotTimeBeforeRespawnChanged(int);


signals:
    void signalLog(QString title, QString content, QColor colorTitle = QColor(), QColor colorText = QColor());
    void signalLog(QString content, QColor color = QColor());
};

#endif // MONSTERWIDGET_H
